﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Linq.Expressions;

namespace Infinity.Expressions
{
	/// <summary>
	/// Ciklusok könnyebb készítésére lehet használni
	/// </summary>
	public partial class LoopBuilder
	{
		protected LoopExpression LoopExpression { get; set; }

		protected BlockBuilder _Body;
		protected LabelTarget _ContinueLabel;
		protected LabelTarget _BreakLabel;

		public LabelTarget ContinueLabel
		{
			get { return _ContinueLabel; }
			set { _ContinueLabel = value; }
		}

		public LabelTarget BreakLabel
		{
			get { return _BreakLabel; }
			set { _BreakLabel = value; }
		}

		public BlockBuilder Body
		{
			get
			{
				return _Body;
			}
			set
			{
				_Body = value;
			}
		}
		
		public void RefreshLoop()
		{
			LoopExpression = LoopExpression.Update(BreakLabel, ContinueLabel, Body);
		}
	}
}
